package Demo2;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-21
 * Time: 18:46
 */
public class Test {
    public void func(Animal animal){
        animal.eat();
    }

    public void iFly(IFly _fly){
        _fly.fly();
    }

    public void iRun(IRun _run){
        _run.run();
    }

    public void iSwim(ISwim _swim){
        _swim.swim();
    }

    public static void main(String[] args) {
        Dog dog1 = new Dog("大黄",11);
        Dog dog2 = new Dog("大黄",11);

        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
        System.out.println(dog1.equals(dog2));
    }
    public static void main2(String[] args) {
        Test t = new Test();

        t.iFly(new Duck("唐老鸭",9));

        t.iRun(new Dog("大黄",11));
        t.iRun(new Duck("唐老鸭",9));

        t.iSwim(new Fish("小鱼儿",8));
        t.iSwim(new Dog("小黄",6));
        t.iSwim(new Duck("唐老鸭",10));
    }
    public static void main1(String[] args) {
        Test t = new Test();
        t.func(new Dog("大黄",11));
        t.func(new Duck("唐老鸭",7));
        t.func(new Fish("小鱼儿",8));
    }
}
